<?php
function removeButtonValueFunction($person) {
	return html::anchor('admin/foreignPoliceExport/removePerson?person_id=' . $person['id'], html::img('remove.png'));
}

echo '<div id="exportList">';
if ($personList) {
	echo '<h3>Vybrané osoby</h3>';

	$eb = new EntityListBuilder('person', $personList);
	$eb->text('last_name')->linkWithValue('admin/person/display?id=', 'id');
	$eb->text('first_name');
	$eb->date('birth_date');
	// $eb->text('other_names');
	$eb->text('idcard_number');
	$eb->text('idcard_type_name')->labelKey('idcard_type');
	$eb->text('citizenship_name')->labelKey('citizenship_code');
	$eb->text('street');
	$eb->text('city');
	$eb->text('postal_code');
	$eb->text('country_name')->labelKey('country_code');
	$eb->text('')->labelKey('util.emptyString')->valueFunction('removeButtonValueFunction');
	$eb->write();

	$fb = new FormBuilder('person', array());
	$fb->setAction('/admin/foreignPoliceExport/export');
	$fb->submitButton('button-export')->image('action/excel.png');
	$fb->write();
}
echo '</div>';